package com.iplant.basic.service.po.fmc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.basic.service.basicenum.bfc.FMCShiftType;

import java.io.Serializable;
import java.util.Calendar;


@DBBasePO(TableName = "fmc_time_zone", Code = false, Name = false,
        CheckName = {"ShiftID,StartTime,Active"})
public class FMCTimeZone extends BasePO implements Serializable {

    private static final long serialVersionUID = 1L;

    @DBField
    public Calendar StartTime = Calendar.getInstance();// 开始时刻

    @DBField
    public Calendar EndTime = Calendar.getInstance();// 开始时刻

    @DBField
    public int Minutes = 0; // 时长;

    @DBField
    public int IdleOrWork = 0; // 1:休息，0：工作

    @DBCondition
    @DBField
    public int ShiftID = 0;


    @DBCondition
    @DBJoin(name = "ShiftType", tableName = "fmc_shift", tableAsName = "s1", MainTableField = "ShiftID")
    public int ShiftType = 0; // 1--3：早、中、晚;


    public String ShiftTypeName = "";

    @DBJoin(name = "Name", tableName = "fmc_shift", tableAsName = "s1", MainTableField = "ShiftID")
    public String ShiftName = "";


    @JsonProperty("StartTime")
    public Calendar getStartTime() {
        return StartTime;
    }

    public void setStartTime(Calendar startTime) {
        StartTime = startTime;
    }

    @JsonProperty("EndTime")
    public Calendar getEndTime() {
        return EndTime;
    }

    public void setEndTime(Calendar endTime) {
        EndTime = endTime;
    }

    @JsonProperty("Minutes")
    public int getMinutes() {
        return Minutes;
    }

    public void setMinutes(int minutes) {
        Minutes = minutes;
    }

    @JsonProperty("IdleOrWork")
    public int getIdleOrWork() {
        return IdleOrWork;
    }

    public void setIdleOrWork(int idleOrWork) {
        IdleOrWork = idleOrWork;
    }

    @JsonProperty("ShiftID")
    public int getShiftID() {
        return ShiftID;
    }

    public void setShiftID(int shiftID) {
        ShiftID = shiftID;
    }

    @JsonProperty("ShiftType")
    public int getShiftType() {
        return ShiftType;
    }

    public void setShiftType(int shiftType) {
        ShiftType = shiftType;
    }

    @JsonProperty("ShiftName")
    public String getShiftName() {
        return ShiftName;
    }

    public void setShiftName(String shiftName) {
        ShiftName = shiftName;
    }

    @JsonProperty("ShiftTypeName")
    public String getShiftTypeName() {
        ShiftTypeName = FMCShiftType.getEnumType(ShiftType).getLabel();
        return ShiftTypeName;
    }

    public void setShiftTypeName(String shiftTypeName) {
        ShiftTypeName = shiftTypeName;
    }
}
